CC = gcc
CPLUSPLUS = g++
OBJ = obj

CCFLAGS = -fPIC -g -Wall -O3 -w -lpthread -lm -ldl
CPPFLAGS = -lstdc++ -fPIC -g -O3 -Wall -w -lpthread -lm -ldl

INC = -I./ -I/libuuid/include -Ikcp
LIB_PATH = -L./libuuid/lib -luuid
LIBS =

OBJS = task.o udpsock.o tcpsock.o \
		nettool.o mutex.o icmp.o \
		simclist.o kcp/ikcp.o peerlist.o \
		mytime.o id.o lansearch.o msgque.o \
		log.o cJSON.o epolls.o

all: server client
	chmod 777 server; chmod 777 client

.c.o:
	$(CC) -c $(INC) $(CFLAGS) $< -o $@

#.cpp.o:
#	$(CPLUSPLUS) -c $(INC) $(CPPFLAGS) $< -o $@
	
clean:
	rm -rf $(OBJS) server client

server: $(OBJS) server.o
	$(CC) -g -o $@  $^ $(INC) $(LIB_PATH) $(CCFLAGS) 

client: $(OBJS) client.o
	$(CC) -g -o $@  $^ $(INC) $(LIB_PATH) $(CCFLAGS)
